import { MidwayConfig } from '@midwayjs/core';
// import { Photo } from '../entity/photo.entity';
import { tmpdir } from 'os';
import { join } from 'path';
export default {
  busboy: {
    // mode: UploadMode, 默认为file，即上传到服务器临时目录，可以配置为 stream
    mode: 'file',
    // fileSize: string, 最大上传文件大小，默认为 10mb
    fileSize: '20mb',
    tmpdir: join(tmpdir(), 'midway-busboy-files'),
    cleanTimeout: 5 * 60 * 1000,
  },

  // use for cookie sign key, should change to your own and keep security
  keys: '1729042421312_8781',
  koa: {
    port: 1551,
  },
  cors: {
    origin: '*', // 允许所有源访问，或者你可以指定特定的源，如 'http://example.com'
    allowMethods: ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH'],
    allowHeaders: ['*'],
    exposeHeaders: [],
    maxAge: 86400,
    credentials: false,
  },
  typeorm: {
    dataSource: {
      default: {
        /**
         * 单数据库实例
         */
        type: 'mysql',
        host: 'localhost',
        port: 3306,
        username: 'root',
        password: '1069823581',
        database: 'yfy',
        synchronize: true,
        logging: true,
        entities: ['**/entity/*.entity{.ts,.js}'],
      },
    },
  },
} as MidwayConfig;
